const getDefaultState = () => {
  return {
    todoList: [],
  };
};

const state = getDefaultState();

const mutations = {
  RESET_STATE: (state) => {
    Object.assign(state, getDefaultState());
  },
  SET_TODOLIST: (state, data) => {
    state.todoList = data;
  },
};

const actions = {
  getTodoList({ commit, state }, data) {
    commit("SET_TODOLIST", data);
  },
};

export default {
  namespaced: true,
  state,
  mutations,
  actions,
};
